package com.lxs.activity;

import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.lxs.uitest.R;

public class LifeCycleActivity
        extends AppCompatActivity
        implements View.OnClickListener
        , DialogInterface.OnClickListener {

    private static final String TAG = "TAG";
    private Button btnlifecycle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_life_cycle);
        btnlifecycle = (Button) findViewById(R.id.btn_life_cycle);

        btnlifecycle.setOnClickListener(this);
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.i(TAG, "===============onRestart: ===============");
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.i(TAG, "===============onStart: ==================");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.i(TAG, "===============onResume:=============== ");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.i(TAG, "===============onPause:=============== ");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.i(TAG, "===============onStop:=============== ");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.i(TAG, "===============onDestroy:=============== ");
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_life_cycle:

                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.setTitle("标题")
                        .setMessage("Message")
                        .setPositiveButton("确定", this)
                        .setNegativeButton("取消", this)
                        .create().show();
                break;
        }
    }

    @Override
    public void onClick(DialogInterface dialogInterface, int i) {
        switch (i) {
            case DialogInterface.BUTTON_NEGATIVE:

                break;
            case DialogInterface.BUTTON_POSITIVE:
                break;
        }
    }
}
